builder-tool: Try harder to find types
authorMatthias Clasen <mclasen@redhat.com>
Thu, 18 Jan 2018 22:45:12 +0000 (17:45 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 18 Jan 2018 22:45:12 +0000 (17:45 -0500)
If g_type_from_name fails, try gtk_builder_get_type_from_name
before giving up. This fixes cases like GtkPrinterOptionWidget.

gtk/gtk-builder-tool.c

index 8ed47edd026d8bc0f83eb52cd337f4a0472a217e..ebd965ec12c7710f61a7d0395dc62d5a3f4c0538 100644 (file)
@@ -80,7 +80,13 @@ get_property_pspec (MyParserData *data,
 
   type = g_type_from_name (class_name);
   if (type == G_TYPE_INVALID)
-    return NULL;
+    {
+      GtkBuilder *builder = gtk_builder_new ();
+      type = gtk_builder_get_type_from_name (builder, class_name);
+      g_object_unref (builder);
+      if (type == G_TYPE_INVALID)
+        return NULL;
+    }
 
   class = g_type_class_ref (type);
   canonical_name = g_strdup (property_name);
@@ -197,7 +203,6 @@ needs_explicit_setting (MyParserData *data,
     { "GtkGrid", "top-attach", 1 },
     { "GtkWidget", "hexpand", 0 },
     { "GtkWidget", "vexpand", 0 },
-    { "GtkVBox", "expand", 1 },
     { NULL, NULL, 0 }
   };
   gchar *canonical_name;